﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

using Httlgd.DataCenter.Services.Common;
using Httlgd.DataCenter.Services.Core;
using Httlgd.DataCenter.Services.Core.Common;
using Httlgd.DataCenter.Services.Sms.DataAccess.EntityFramework;

namespace Httlgd.DataCenter.Services.Sms.DataAccess
{
    class BibleScriptureDAL : Httlgd.DataCenter.Services.Core.DataAccessorBase<Httlgd.DataCenter.Services.Sms.DataTransferObject.BibleScriptureDTO, 
        Httlgd.DataCenter.Services.Sms.DataAccess.EntityFramework.BibleScripture, 
        Httlgd.DataCenter.Services.Sms.DataAccess.EntityFramework.SermonManagementEntities>
    {
        public BibleScriptureDAL() : base()
        {

        }

        public BibleScriptureDAL(SermonManagementEntities context) : base(context)
        {

        }

        protected override BibleScripture MapBusinessEntityToEntity_ScalarInner(Httlgd.DataCenter.Services.Sms.DataTransferObject.BibleScriptureDTO businessEntity, BibleScripture entity)
        {
            entity = base.MapBusinessEntityToEntity_ScalarInner(businessEntity, entity);

            entity.Sermon = this.objectContext.Sermon.Where(r => r.ID == businessEntity.SermonID).FirstOrDefault();
            entity.BibleBook = this.objectContext.BibleBook.Where(r => r.ID == businessEntity.BibleBookID).FirstOrDefault();

            return entity;
        }
    }
}
